module.exports = (api) => {
  return {
    presets: [
      [
        '@nuxt/babel-preset-app',
        {
          useBuiltIns: 'usage',
          corejs: {
            version: 3,
          },
          // caller.target will be the same as the target option from webpack
          targets: api.caller((caller) => caller && caller.target === 'node')
            ? { node: 'current' }
            : { chrome: '58', ie: '9' },
        },
      ],
    ],
    plugins: [
      [
        'import',
        {
          libraryName: 'vant',
          libraryDirectory: 'es',
          style: (name) => `${name}/style/less.js`,
        },
        'vant',
      ],
    ],
  };
};
